import {Route} from '@srcTypes/route';
import {requestLogger} from '@srcMiddleware/request-logger';
import {
    createDoc,
    deleteDoc,
    getDocMetaReq,
    getFolderChildrenWithOutMeta,
    getRootFolder,
} from '@srcHandlers/docs/doc';
import {createSheet, deleteSheet} from '@srcHandlers/docs/sheets';

export const docsRoutes: Route[] = [
    {
        method: 'get',
        path: '/doc/v1/meta/:docToken',
        middleware: [requestLogger],
        handler: getDocMetaReq,
    },
    {
        method: 'get',
        path: '/doc/v1/root_folder',
        middleware: [requestLogger],
        handler: getRootFolder,
    },
    {
        method: 'get',
        path: '/doc/v1/folder/children',
        middleware: [requestLogger],
        handler: getFolderChildrenWithOutMeta,
    },
    {
        method: 'delete',
        path: '/doc/v1/file/:docToken',
        middleware: [requestLogger],
        handler: deleteDoc,
    },
    {
        method: 'post',
        path: '/doc/v1/create',
        middleware: [requestLogger],
        handler: createDoc,
    },
    {
        method: 'delete',
        path: '/sheet/v1/file/:sheetToken',
        middleware: [requestLogger],
        handler: deleteSheet,
    },
    {
        method: 'post',
        path: '/sheet/v1/create',
        middleware: [requestLogger],
        handler: createSheet,
    },
];
